// https://nuxt.com/docs/api/configuration/nuxt-config
import { loadEnv } from 'vite';

export default defineNuxtConfig({
  modules: [
    '@pinia/nuxt'
  ],
  compatibilityDate: "2024-11-01",
  devtools: { enabled: true },
  css: ["~/styles/main.less", "~/styles/editor.css"],
  plugins: ["~/plugins/routeGuard.ts"],
  vite: {
    css: {
      preprocessorOptions: {
        less: {
          additionalData: `@import "@/styles/main.less";`
        }
      }
    },
    server: {
      proxy: {
        '/api': {
          target: process.env.API_BASE_URL || 'http://127.0.0.1:3001',
          changeOrigin: true,
          rewrite: path => path.replace(/^\/api/, ''),
        }
      }
    }
  }
});
